<?php

class SiteController extends Controller
{
	public $layout = 'login';
	public $defaultAction='Login';
	
	public function actions()
	{
		return array(
            'captcha'=> array(
                //加载外部的action class
    	    'class' => 'CCaptchaAction',
                //设置验证码图片背景色属性
    	    'backColor' => 0xffffff,
    	    ),
        );
	}

	/* 
	 * index action
	 *  */
	public function actionIndex()
	{
		echo "This is a Index action";
	}
	
	/* 
	 *  */
	public function actionLogin(){
		if(!Yii::app()->user->isGuest){//已登陆
			$this->redirect(array('Manager/index'));
		}
		$model=new LoginForm;	
		
		$this->render('login',array('model'=>$model));
	}
    
    public function actionActLogin(){
       $captcha = $this->createAction('captcha')->getVerifyCode();
       echo $captcha;
    }
	
	/* error action
	 *  */
	public function actionError()
	{
	    echo "Error Page!";
	}
}